package cn.my.framework.common.repo;

import cn.my.framework.common.entity.RolePerm;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by zhangl_lc on 2017/7/6.
 */
public interface RolePermRepo extends JpaRepository<RolePerm,Integer> {

    @Query(value = "select DISTINCT p.code as permCode,p.url,rp.role_code as roleCode from permission p inner join role_perm rp on rp.perm_code = p.code",nativeQuery = true)
    List<Object[]> selectPerms();
}
